<template>
  <!-- 销售价试算 -->
  <div>
    <custom-container
      ref="customContainerRef"
      :config="mainConfig"
    ></custom-container>
  </div>
</template>
<script lang="ts" setup>
import { computed, ref } from 'vue'
import { DictDirection } from '@/store/modules/dicts'
import { sellTrial } from '@/api/basicConfig/trial.ts'

const // 查询
  queryParams = ref({
    pageNum: 1,
    pageSize: 10,
    custCodeList: undefined,
    wholeName: undefined,
    simpleName: undefined,
    status: undefined,
    grade: undefined,
  })

const mainConfig = computed({
  get() {
    return {
      initList: false,
      query: {
        fields: [
          {
            type: 'selectv2',
            label: '目的国家',
            prop: 'countryCode',
            option: {
              clearable: true,
              dictInfo: { 
                dict: DictDirection.国家,
                dictValue: 'countryCode',
                dictLabel: 'countryChName', 
              },
            },
          },
          {
            label: '重量',
            prop: 'weight',
          },
          {
            type: 'select',
            label: '销售产品：',
            prop: 'salesProductCode',
            option: {
              clearable: true,
              dictInfo: { dict: DictDirection.产品 },
            },
          },
          {
            type: 'select',
            label: '货物类型',
            prop: 'goodsType',
            width: '240',
            option: {
              placeholder: '请选择货物类型',
              clearable: true,
              dictInfo: { dict: DictDirection.货物类型 },
            },
          },
          {
            label: '邮编',
            prop: 'postCode',
            option: {
              controls: false,
            },
          },
          {
            type: 'select',
            label: '收款货币：',
            prop: 'chargeCurrency',
            option: {
              controls: false,
              clearable: true,
              dictInfo: { dict: DictDirection.收款币种 },
            },
          },
          {
            type: 'select',
            label: '价格等级：',
            prop: 'priceGrade',
            width: '240',
            option: {
              placeholder: '请选择价格等级',
              clearable: true,
              dictInfo: { dict: DictDirection.价格等级 },
            },
          },
          {
            type: 'select',
            label: '产品分类：',
            prop: 'productType',
            width: '240',
            option: {
              placeholder: '请选择产品分类 ',
              clearable: true,
              dictInfo: { dict: DictDirection.产品分类 },
            },
          },
        ],
        queryParams: queryParams.value,
        formOption: {
          rules: {
            countryCode: [{ required: true, message: '请选择目的国家' }],
            weight: [{ required: true, message: '请输入重量' }],
          },
        },
      },
      btns: [],
      table: {
        columns: [
          {
            prop: 'salesProductCode',
            label: '销售产品代码',
            width: '180',
          },
          {
            prop: 'salesProductName',
            label: '产品中文名称',
            width: '180',
          },
          {
            prop: 'weight',
            label: '重量',
          },
          {
            prop: 'unitPrice',
            label: '销售单价',
          },
          {
            prop: 'totalPrice',
            label: '销售总价',
          },
          {
            prop: 'volumeCoefficient',
            label: '材级系数',
          },
          {
            prop: 'expirationDate',
            label: '失效日期',
          },

          {
            prop: 'billingType',
            label: '计费方式',
          },

          {
            prop: 'goodsType',
            label: '货物类型',
          },
        ],
      },
      api: sellTrial,
    }
  },
  set(v) {
    return v
  },
})
</script>
